<!-- 基本属性信息 -->
<template>
    <el-form label-width="100px" size="small">
        <el-row>
            <el-col :span="12">
                <el-form-item :label="$t('屏幕名称')+':'">
                   {{ editorForm.screenName }}
                </el-form-item>
                <el-form-item :label="$t('屏幕高度')+':'">
                    {{ editorForm.height }}
                </el-form-item>
                <el-form-item :label="$t('所属分组')+':'">
                    {{ editorForm.groupName }}
                </el-form-item>
                <el-form-item :label="$t('车辆编号')+':'">
                    {{ editorForm.carNo }}
                </el-form-item>
                <el-form-item :label="$t('状态')+':'">
                    {{ editorForm.online | onlineFilter(te) }}
                </el-form-item>
                <el-form-item :label="$t('标签')+':'">
                    {{ editorForm.tagList | tagListFilter }}
                </el-form-item>
            </el-col>
            <el-col :span="12">
                <el-form-item :label="$t('屏幕地址')+':'">
                    {{ editorForm.macText }}
                </el-form-item>
                <el-form-item :label="$t('屏幕宽度')+':'">
                    {{ editorForm.width }}
                </el-form-item>
                <el-form-item :label="$t('车牌号码')+':'">
                    {{ editorForm.carLicense }}
                </el-form-item>
                <el-form-item :label="$t('车辆温度')+':'">
                    {{ editorForm.temperature }} ℃
                </el-form-item>
            </el-col>
        </el-row>
    </el-form>
</template>

<script>
export default {
    name: "ScreenBasicSetInfo",
    data() {
        return {
        }
    },
    filters: {
        tagListFilter(val) {
            let msg = ''
            if(val) {
                const obj = val.reduce((pre, item) => {
                const tgname = item.tagCategoryName
                pre.item.push(item.tagName)
                return {name: tgname, item: pre.item}
                }, {
                name: '',
                item: []
                })
                return obj.name + ':' + obj.item.join(" ")
            }
            return ''
        },
        onlineFilter(val,te) {
            if(val === 0) {
                return te('离线')
            }else if(val === 1) {
                return te('在线')
            }else if(val === 2) {
                return te('待机')
            }
        }
    },
    props: {
        editorForm: {
            default:{}
        }
    },
    methods:{
        te(arg) {
            const hasKey = this.$te(arg)
            if (hasKey) {
            const result = this.$t(arg)
            return result
            }
            return arg
        },
    }
}
</script>